class Node {
  constructor(data) {
    this.data = data
    this.next = null
  }
}

class singleLinked {
  constructor() {
    this.size = 0
    this.head = new Node('head')
    this.currentNode = ''
  }

  isEmpty() {
    return this.size === 0
  }

  getLength() {
    return this.size
  }

  // 向链表最后一个节点追加节点
  appendNode(data) {
    let newNode = new Node(data)
    let lastNode = this.findLastNode()
    lastNode.next = newNode
    this.size++
  }

  findLastNode() {
    let currentNode = this.head
    while (currentNode.next !== null) {
      currentNode = currentNode.next
    }
    return currentNode
  }

  findNode(ele) {
    let currentNode = this.head
    while(currentNode.next !== null && currentNode.next.data !== ele) {
      if (currentNode.next.data === ele) {

      } else {
         currentNode = currentNode.next
      }
    }
  }
}